<?php
/*
 * Script to fetch the information from the database.
 */

include "dbinfo.php";

$connect = mysqli_connect($databaseHost,$databaseUsername,$databasePassword,$databaseName) or die(mysql_error());
$query = "SELECT * FROM events"; 
$result = mysqli_query($connect, $query);

if (mysqli_connect_errno()) { 
    header("HTTP/1.1 500 Internal Server Error");
    echo $query.'\n';
    echo mysqli_connect_errno(); 
}
else
{
	
    $rows = array();
    while($r = mysqli_fetch_assoc($result)) {
        $rows[] = $r;
    }
    print json_encode($rows);
}
?>
